Promise.resolve2 = (value) =>{
    //是Promise实例，直接返回即可
    if(value && typeof value === 'object' && value instanceof Promise){
        return value
    }

    // 否则其他情况一律再通过Promise包装一下 
    return new Promise((resolve) => {
        resolve(value)
    })
}
// 测试1
Promise.resolve(111).then(res=>{
    console.log(res)
})

Promise.resolve2(111).then(res=>{
    console.log(res)
})

// 测试2:参数是一个Promise

const p = new Promise((resolve) =>{
    resolve(222)
})
Promise.resolve(p).then(res=>{
    console.log(res)
})
Promise.resolve2(p).then(res=>{
    console.log(res)
})